#@adminLayout()
#define main()
#set(map={C:1,R:1,U:1,D:0,O:1},
aTh = [  "ID","序号",  "上级",  "名称",  "字段",   "状态" ],
aTd = [  "id", "number", "pid",  "name",  "field",   "state" ])
<div class="card">
    #@cardIndex("数据字典管理","ciis/dictionary",map,aTh,aTd)
</div>
#end

###条件模糊查询
#define cardQuery()
        <div class="col-sm-4">
            <div class="form-group">
                <lable><i class="zmdi zmdi-label-alt zmdi-hc-fw"></i>上级</lable>
                <input type="text" name="pid" value="#(model.pid??)"
                       class="form-control" placeholder="请输入上级">
                <i class="form-group__bar"></i>
            </div>
        </div>
        <div class="col-sm-4">
            <div class="form-group">
                <lable><i class="zmdi zmdi-label-alt zmdi-hc-fw"></i>名称</lable>
                <input type="text" name="name" value="#(model.name??)"
                       class="form-control" placeholder="请输入名称">
                <i class="form-group__bar"></i>
            </div>
        </div>
        <div class="col-sm-4">
            <div class="form-group">
                <lable><i class="zmdi zmdi-label-alt zmdi-hc-fw"></i>字段</lable>
                <input type="text" name="field" value="#(model.field??)"
                       class="form-control" placeholder="请输入字段">
                <i class="form-group__bar"></i>
            </div>
        </div>
        <div class="col-sm-4">
            <div class="form-group">
                <lable><i class="zmdi zmdi-label-alt zmdi-hc-fw"></i>状态0启用1禁用</lable>
                <input type="text" name="state" value="#(model.state??)"
                       class="form-control" placeholder="请输入是否删除0无效1有效">
                <i class="form-group__bar"></i>
            </div>
        </div>
#end

###自定义表格数据内容,如果使用目前方式，导出功能的数据需要自定义
#define cardIndexTbody()
<td data-column="state">#(x.state==0?'<span class="text-success">启用</span>':'<span class="text-danger">禁用</span>')</td>
#end

####表格上方自定义按钮
#define cardBtn()
#end

##表格自定义按钮
#define cardIndexBtn()
    #if(x.state==0)
        <button class="btn btn-sm btn-outline-danger waves-effect" onclick="meditate('#(x.id)',1)" title="禁用">
            <i class="zmdi zmdi-close"></i>禁用
        </button>
    #else
        <button class="btn btn-sm btn-outline-success waves-effect" onclick="meditate('#(x.id)',0)" title="启用">
            <i class="zmdi zmdi-check"></i>启用
        </button>
    #end
#end
<script>
    /*更改状态*/
    function meditate(a,b) {
        kPost("/admin/ciis/dictionary/modifyState?id="+a+"&state="+b,"/admin/ciis/dictionary");
    }
</script>
